﻿using System;
using System.Configuration;

namespace CodePlex.TfsPluginSuite.Configuration.ChangeTypePolicy
{
    [ConfigurationCollection(typeof(AllowedChangeTypeConfigurationElement), AddItemName = "AllowedChangeType", CollectionType = ConfigurationElementCollectionType.BasicMap)]
    public class FolderConfigurationElement  : ConfigurationElementCollection
    {
        protected override ConfigurationElement CreateNewElement()
        {
            return new AllowedChangeTypeConfigurationElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            return ((AllowedChangeTypeConfigurationElement)element).Name;
        }

        [ConfigurationProperty("pathRegex", IsRequired = true)]
        public string Regex
        {
            get
            {
                return (string)base["pathRegex"];
            }
        }

    }
}
